/* TotalDcmListerPluginInterface.h -- Defines the exported functions for the DLL application.
*
* TotalDcmLister - A lister plugin for Total Commander for listing DICOM File content.
*
* Copyright (C) 2015 Captain Stark
*
* This software may be modified and distributed under the terms of the MIT license.
* See the COPYRIGHT file at the top-level directory of this distribution for details.
*/

#pragma once

#include "stdafx.h"

/// <summary>
/// ListDefaultParamStruct is passed to ListSetDefaultParams to inform the plugin about the current 
/// plugin interface version and ini file location.
/// </summary>
typedef struct
{
   /// <summary>
   /// The size of the structure, in bytes. Later revisions of the plugin interface may add more structure members, 
   /// and will adjust this size field accordingly.
   /// </summary>
   int size;

   /// <summary>
   /// Low value of plugin interface version. This is the value after the comma, multiplied by 100! 
   /// Example. For plugin interface version 1.3, the low DWORD is 30 and the high DWORD is 1.
   /// </summary>
   DWORD PluginInterfaceVersionLow;

   /// <summary>
   /// The plugin interface version hiHigh value of plugin interface version.
   /// </summary>
   DWORD PluginInterfaceVersionHi;

   /// <summary>
   /// Suggested location+name of the ini file where the plugin could store its data. 
   /// This is a fully qualified path+file name, and will be in the same directory as the wincmd.ini. 
   /// It's recommended to store the plugin data in this file or at least in this directory, because the plugin 
   /// directory or the Windows directory may not be writable!
   /// </summary>
   char DefaultIniName[MAX_PATH];
} ListDefaultParamStruct;


/// <summary>
/// ListGetDetectString is called when the plugin is loaded for the first time. 
/// It should return a parse function which allows Lister to find out whether your plugin can probably handle the file 
/// or not. You can use this as a first test - more thorough tests may be performed in ListLoad(). 
/// It's very important to define a good test string, especially when there are dozens of plugins loaded! 
/// The test string allows lister to load only those plugins relevant for that specific file type.
/// </summary>
/// <param name="detectString">The detection string.</param>
/// <param name="maxlen">Maximum length, in bytes, of the detection string (currently 2k).< / param>
void APIENTRY ListGetDetectString(char* detectString, int maxlen);

/// <summary>
/// ListSetDefaultParams is called immediately after loading the DLL, before ListLoad. 
/// This function is new in version 1.2. It requires Total Commander >=5.51, but is ignored by older versions.
/// </summary>
/// <param name="dps">
/// This structure of type ListDefaultParamStruct currently contains the version number of the plugin interface, 
/// and the suggested location for the settings file (ini file). It is recommended to store any plugin-specific 
/// information either directly in that file, or in that directory under a different name. 
/// Make sure to use a unique header when storing data in this file, because it is shared by other file system plugins! 
/// If your plugin needs more than 1kbyte of data, you should use your own ini file because ini files are limited to 64k.
/// </param>
void APIENTRY ListSetDefaultParams(ListDefaultParamStruct* dps);

/// <summary>
/// ListLoad is called when a user opens lister with F3 or the Quick View Panel with Ctrl+Q, and when the definition 
/// string either doesn't exist, or its evaluation returns true.
/// </summary>
/// <param name="parentWin">This is lister's window. Create your plugin window as a child of this window.< / param>
/// <param name="fileToLoad">The name of the file which has to be loaded.</param>
/// <param name="showFlags">The show flags.</param>
/// <returns>A handle to lister window if load succeeds, NULL otherwise.< / returns>
HWND APIENTRY ListLoad(HWND parentWin, char* fileToLoad, int showFlags);

/// <summary>
/// ListCloseWindow is called when a user closes lister, or loads a different file.
/// </summary>
/// <param name="listView">This is the window handle which needs to be destroyed.< / param>
void APIENTRY ListCloseWindow(HWND listWin);
